package util;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import model.User;

import java.util.Map;

public class logininter extends AbstractInterceptor {

    @Override
    public String intercept(ActionInvocation arg0) throws Exception {
        Map session = (Map) arg0.getInvocationContext().getSession();
        User user = (User) session.get("user");
        if (user == null)
            return Action.LOGIN;
        return arg0.invoke();
    }

}
